<?php
class Mdl_nav_helper extends Model
{
    function __construct()
    {
        parent::model();
    }

    function Mdl_nav_helper()
    {
        self::__construct();
    }

    function get_navigation()
    {
       $this->db->where('id >=', '1');
       $this->db->where('front_nav >=', '1');
       $this->db->order_by('navigation_order', 'asc');
       $query = $this->db->get('routes');
       return $query->result_array();
    }
	
	function get_breadcrumbs()
	{
		$this->load->helper('url');
		$initial_result_url = str_replace( base_url(), "", current_url() );
		$initial_result_url = str_replace( index_page(), "", $initial_result_url );
		
		$initial_result_text = explode( "/", uri_string() );
		$i = 0;
		foreach ($initial_result_text as $item){
			if ($item !== ""){
				$url = $initial_result_url;
				$result[$i]['url'] = $url;
				$result[$i]['text'] = $item;
				$i++;
			}
		}
		if ( isset($result) ) {
			return $result;
		}
	}
}
